 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">

<ui:composition template="/template.xhtml">

	<ui:define name="title">
	ShopX | Basket Page
	</ui:define>

	<ui:define name="body">
		<h:outputText value="#{msgs.emptyBasket}" rendered="#{orderBean.totalGoodsNumber==0}" styleClass="title" />
  		
  		<h:dataTable value="#{basketBacking.goodsBeans}" var="goods" rules="all" 
  		rendered="#{orderBean.totalGoodsNumber>0}"
  		columnClasses="oddColumn, evenColumn, oddColumn" headerClass="featuresHeader" footerClass="featuresHeader">
			
			<h:column>
 			<f:facet name="header">Goods</f:facet>
 			<h:form>
 			<h:commandLink id="link" value="#{goods.producerValue} #{goods.modelValue}" 
			action="#{redirectNavigator.getFeaturesOutcome}" actionListener="#{redirectNavigator.processSelectedElement}">
			<f:param name="redirect" value="#{goods.goodsID}"/>		
			</h:commandLink>   
			</h:form>
 			</h:column>

			<h:column>
 			<f:facet name="header">Price</f:facet>
 			<h:outputText value="#{goods.priceBYRValue}">
			<f:converter binding="#{priceConverter.instance}" /> </h:outputText>
			<f:facet name="footer">
 				<h:outputText value="#{orderBean.totalPrice}">
				<f:converter binding="#{priceConverter.instance}" />
				</h:outputText>
 			</f:facet>	
 			</h:column>
 			
 			<h:column>
 			<f:facet name="header">Quantity</f:facet>
 				 #{orderBean.basket[goods]} 			
 			</h:column> 			
 			
 			<h:column>
 			<h:form> 			
 			<h:commandButton value="Remove" actionListener="#{basketBacking.remove}" >
 			<f:param name="choose" value="#{goods.goodsID}"/>
 			</h:commandButton>
 			</h:form>
 			</h:column>
 			
		</h:dataTable>
		<h:form>
     	<h:commandButton value="Clear basket" actionListener="#{basketBacking.clearAll}" 
     		rendered="#{orderBean.totalGoodsNumber>0}" />
     	<h:commandButton value="Make order" action="#{redirectNavigator.getOrderOutcome}" 
     		rendered="#{orderBean.totalGoodsNumber>0}" />
   		</h:form>
    </ui:define>
 </ui:composition>

</html>